#include "./test.h"
#include "../include/queue.h"
TEST(QUEUE)
{
    Queue queue;
    Queue_Init(&queue,32);
    for (int i = 0; i < 32; i++)
    {
        Queue_Push(&queue, TINTEGER(i));
    }
    for (int i = 32; i > 0; i--)
    {
        TValue value = Queue_Pop(&queue);
        assert(i - 1 == value.value.integer);
    }

    for (int i = 0; i < 64; i++)
    {
        Queue_Shift(&queue, TINTEGER(i));
    }
    for (int i = 64; i > 0; i--)
    {
        TValue value = Queue_UnShift(&queue);
        assert(i - 1 == value.value.integer);
    }

    for (int i = 0; i < 32; i++)
    {
        Queue_Set(&queue, i, TINTEGER(i));
    }
    for (int i = 0; i < 32; i++)
    {
        TValue value = Queue_Get(&queue, i);
        assert(i == value.value.integer);
    }

    for (int i = 0; i < 32; i++)
    {
        Queue_Insert(&queue, i, TINTEGER(i));
    }
    for (int i = 0; i < 32; i++)
    {
        TValue value = Queue_Get(&queue, i);
        assert(i == value.value.integer);
    }

    for (int i = 0; i < 64; i++)
    {
        Queue_Remove(&queue, 0);
    }
    assert(queue.length == 0);

    for (int i = 0; i < 512; i++)
    {
        Queue_Shift(&queue, TINTEGER(i));
        Queue_Push(&queue, TINTEGER(i));
    }

    for (int i = 0; i < 512; i++)
    {
        TValue value1 = Queue_Get(&queue, i);
        TValue value2 = Queue_Get(&queue, 1023 - i);
        assert(value2.value.integer == value1.value.integer);
    }

    Delete_Queue((Object *)&queue);
}